package com.bank.service;


import com.bank.repository.CustomerRepo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

public abstract class EntityService<T, R extends CustomerRepo<T, Integer>> {
    protected R repo;

    protected EntityService(R repo) {
        this.repo = repo;
    }


    public T findOne(Integer id) {
        return repo.findOne(id);
    }

    public Page<T> findPage(Pageable pageable) {
        return repo.findAll(pageable);
    }

    public T save(T entity) {
        return repo.save(entity);
    }

    public void deleteById(Integer id) {
        repo.delete(id);
    }
}
